package com.microstation.util;

import java.io.File;

public class FilePathUtil {
    public final static String IMAGE_TYPE = "image";
    public final static String THUMBNAIL_NAME_SUFFIX = "thumb_";
    private static final String YMD = "yyyy-MM-dd";

    public static String getForderName(String fname) {
        String randomDate = DateUtil.format(System.currentTimeMillis(), YMD);
        return randomDate + File.separator + fname;
    }

    public static String getForderNameOSS(String fname) {
        String randomDate = DateUtil.format(System.currentTimeMillis(), YMD);
        return randomDate + "/" + fname;
    }

    public static String getFileSuffix(String upFileName) {
        return upFileName.substring(upFileName.indexOf("."));
    }

    public static boolean isImage(String imageType) {
        if (!StringUtil.isEmpty(imageType) && StringUtil.trim(imageType).startsWith(IMAGE_TYPE)) {
            return true;
        }
        return false;
    }
}
